import VueRouter from "vue-router";
import LogIn from "@/components/LogIn";
import HelloWorld from "@/components/HelloWorld";
import SignUp from "@/components/SignUp";
import Authorize from "@/components/Authorize";

const routes = [
    {
        path: '/login',
        component: LogIn,
        meta: {
            title: '登录',
        },
        props: (route) => ({ redirect: route.query.redirect }),
    },
    {
        path: '/signup',
        component: SignUp,
        meta: {
            title: '注册',
        },
        props: (route) => ({ redirect: route.query.redirect }),
    },
    {
        path: '/authorize',
        component: Authorize,
        meta: {
            title: '授权',
        },
        props: (route) => ({
            redirect: route.query.redirect,
            description: route.query.description,
            scope: route.query.scope,
        }),
    },
    {
        path: '/',
        component: HelloWorld,
        meta: {
            title: 'Hello World!',
        },
    },
];

const router = new VueRouter({
    routes
});

export default router;
